
<template>
    <div>
        <el-form :inline="true" :model="formInline" class="demo-form-inline" style="border-bottom:1px solid #ccc;">
           <!-- 检验商名称-->
            <el-form-item :label="nowLangue.surveyorName" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--检验库房   -->
            <el-form-item :label="nowLangue.surveyorDepot" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.productLineId" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(product,index) in productLineList" :key="index" :label="product.label" :value="product.value"></el-option>
                </el-select>
            </el-form-item>
            <!--检验库区-->
            <el-form-item :label="nowLangue.surveyorArea" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.status" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(status,index) in statusList" :key="index" :label="status.label" :value="status.value"></el-option>
                </el-select>
            </el-form-item>
            <!-- 检验人员-->
            <el-form-item :label="nowLangue.surveyor" class="selectMB10">
                <el-input size="mini" v-model="formInline.materialName" :placeholder="nowLangue.pleaseImport+nowLangue.surveyor"></el-input>
            </el-form-item>
            <!-- 检验借用单号-->
            <el-form-item :label="nowLangue.testLendCode" class="selectMB10">
                <el-input size="mini" v-model="formInline.materialName" :placeholder="nowLangue.pleaseImport+nowLangue.testLendCode"></el-input>
            </el-form-item>
            <div class="dayChose">
                <!--检验日期-->
                <el-form-item :label="nowLangue.surveyorData" class="selectMB10" >
                    <el-date-picker type="date" :editable="false" v-model="formInline.startCreateTime" clearable :placeholder="nowLangue.pleaseSelect" @change="selectedCreateTimeBegin"></el-date-picker>
                </el-form-item>
                <span v-text="nowLangue.to"></span>
                <el-form-item  class="selectMB10" style="margin-right:20px;">
                    <el-date-picker clearable :editable="false" v-model="formInline.endCreateTime"  type="date" :placeholder="nowLangue.pleaseSelect" @change="selectedCreateTimeEnd"></el-date-picker>
                </el-form-item>
            </div>
            <!-- 备件粒度-->
            <el-form-item :label="nowLangue.spareGranularity" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.status" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(status,index) in statusList" :key="index" :label="status.label" :value="status.value"></el-option>
                </el-select>
            </el-form-item>
            <!-- 备件状态-->
            <el-form-item :label="nowLangue.spareStatus" class="selectMB10">
                <el-select size="mini" clearable v-model="formInline.status" :placeholder="nowLangue.pleaseSelect">
                    <el-option v-for="(status,index) in statusList" :key="index" :label="status.label" :value="status.value"></el-option>
                </el-select>
            </el-form-item>
            <!-- 备件编码-->
            <el-form-item :label="nowLangue.spareCode" class="selectMB10">
                <el-input size="mini" v-model="formInline.materialName" :placeholder="nowLangue.pleaseImport+nowLangue.spareCode"></el-input>
            </el-form-item>
            <!-- 备件名称-->
            <el-form-item :label="nowLangue.spareName" class="selectMB10">
                <el-input size="mini" v-model="formInline.materialName" :placeholder="nowLangue.pleaseImport+nowLangue.spareName"></el-input>
            </el-form-item>
            <el-form-item class="selectMB10">
                <el-button class="bolder outsideBtnBS selectAll" :disabled="selectDisabled" size="mini" type="danger" @click="queryClick()" v-text="nowLangue.query"></el-button>
            </el-form-item>
        </el-form>
        <!--表格-->
        <label class="default-label" v-text="nowLangue.testSpareDetail"></label>
        <el-table :data="testSpareData" border style="width: 100%;" v-loading.body="loading" :element-loading-text="nowLangue.loadDesperately">
            <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
            <!--操作-->
            <el-table-column :label="nowLangue.operate" header-align="center" align="center" width="170">
                <template scope="scope">
                    <!--新增-->
                    <div class="operationItem bolder" @click="add" v-text="nowLangue.addNew"></div>
                    <!--修改-->
                     <div class="operationItem bolder" @click="update" v-text="nowLangue.update"></div>
                    <!--查看-->
                    <div class="operationItem bolder" @click="check" v-text="nowLangue.see"></div>
                    <!--合格判定-->
                    <div class="operationItem bolder" @click="judge" v-text="nowLangue.qualifiedJudge"></div>
                </template>
            </el-table-column>
            <!--备件编码-->
            <el-table-column prop="" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
            <!--备件名称-->
            <el-table-column prop="" :label="nowLangue.spareName" header-align="center"  show-overflow-tooltip></el-table-column>
            <!--数量-->
            <el-table-column prop="" :label="nowLangue.count" header-align="center" show-overflow-tooltip></el-table-column>
            <!--借出数量-->
            <el-table-column prop="" :label="nowLangue.lendCount" header-align="center" show-overflow-tooltip></el-table-column>
            <!--未检验数量-->
            <el-table-column prop="" :label="nowLangue.notTestCount" header-align="center" show-overflow-tooltip></el-table-column>
            <!--电性能检验数量-->
            <el-table-column prop="" :label="nowLangue.electricTestCount" header-align="center" show-overflow-tooltip></el-table-column>
            <!--电性能合格数量-->
            <el-table-column prop="" :label="nowLangue.electricQualifiedCount" header-align="center" show-overflow-tooltip></el-table-column>
            <!--电性能不合格数量-->
            <el-table-column prop="" :label="nowLangue.electricUnqualifiedCount" header-align="center" show-overflow-tooltip></el-table-column>
            <!--批合格判定-->
            <el-table-column prop="" :label="nowLangue.groupQualifiedJudge" header-align="center" show-overflow-tooltip></el-table-column>
            <!--检验方式-->
            <el-table-column prop="" :label="nowLangue.testWay" header-align="center" show-overflow-tooltip></el-table-column>
            <!--检验项目-->
            <el-table-column prop="" :label="nowLangue.testProject" header-align="center" show-overflow-tooltip></el-table-column>
            <!--检验员-->
            <el-table-column prop="" :label="nowLangue.testor" header-align="center" show-overflow-tooltip></el-table-column>
            <!--处理意见-->
            <el-table-column prop="" :label="nowLangue.dealIdea" header-align="center" show-overflow-tooltip></el-table-column>
            <!--计划大类-->
            <el-table-column prop="" :label="nowLangue.planClass" header-align="center" show-overflow-tooltip></el-table-column>
            <!--产品线-->
            <el-table-column prop="" :label="nowLangue.productLine" header-align="center" show-overflow-tooltip></el-table-column>
            <!--供应商名称-->
            <el-table-column prop="" :label="nowLangue.supplierName" header-align="center" show-overflow-tooltip></el-table-column>
            <!--检验借出单号-->
            <el-table-column prop="" :label="nowLangue.lendCount" header-align="center" show-overflow-tooltip></el-table-column>
        </el-table>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                nowLangue:{},
                languageScoped:{
                    zh:{
                        "pleaseSelect":"请选择",
                        "pleaseImport":"请输入",
                        "spareCode":"备件编码",
                        "spareName":"备件名称",
                        "to":"至",
                        "query":"查询",
                        "loadDesperately":"拼命加载中",
                        "sequence":"序",
                        "operate":"操作",
                        "testSpareDetail":"待检验备件明细",
                        "surveyorName":"检验商名称",
                        "surveyorDepot":"检验库房",
                        "surveyorArea":"检验库区",
                        "surveyor":"检验人员",
                        "surveyorData":"检验日期",
                        "testLendCode":"检验借用单号",
                        "spareGranularity":"备件粒度",
                        "spareStatus":"备件状态",
                        "addNew":"新增",
                        "update":"修改",
                        "see":"查看",
                        "qualifiedJudge":"合格判定",
                        "count":"数量",
                        "lendCount":"借出数量",
                        "notTestCount":"未检验数量",
                        "electricTestCount":"电性能检验数量",
                        "electricQualifiedCount":"电性能合格数量",
                        "electricUnqualifiedCount":"电性能不合格数量",
                        "groupQualifiedJudge":"批合格判定",
                        "testWay":"检验方式",
                        "testProject":"检验项目",
                        "testor":"检验员",
                        "dealIdea":"处理意见",
                        "planClass":"计划大类",
                        "productLine":"产品线",
                        "supplierName":"供应商名称"
                    },
                    en:{
                        "pleaseSelect":"pleaseSelect",
                        "pleaseImport":"pleaseImport",
                        "spareCode":"spareCode",
                        "spareName":"spareName",
                        "to":"to",
                        "query":"query",
                        "loadDesperately":"loadDesperately",
                        "sequence":"sequence",
                        "operate":"operate",
                        "testSpareDetail":"testSpareDetail",
                        "surveyorName":"surveyorName",
                        "surveyorDepot":"surveyorDepot",
                        "surveyorArea":"surveyorArea",
                        "surveyor":"surveyor",
                        "surveyorData":"surveyorData",
                        "testLendCode":"testLendCode",
                        "spareGranularity":"spareGranularity",
                        "addNew":"addNew",
                        "update":"update",
                        "see":"see",
                        "qualifiedJudge":"qualifiedJudge",
                        "count":"count",
                        "lendCount":"lendCount",
                        "notTestCount":"notTestCount",
                        "electricTestCount":"electricTestCount",
                        "electricQualifiedCount":"electricQualifiedCount",
                        "electricUnqualifiedCount":"electricUnqualifiedCount",
                        "groupQualifiedJudge":"groupQualifiedJudge",
                        "testWay":"testWay",
                        "testProject":"testProject",
                        "testor":"testor",
                        "dealIdea":"dealIdea",
                        "planClass":"planClass",
                        "productLine":"productLine",
                        "supplierName":"supplierName"
                    }
                },
                // 查询表单
                formInline:{
                    legalPersonId:'',
                    legalPersonCode:"",
                    legalPersonName:'',
                },
                legalPersonLists:[],//法人名称列表
                legalPersonDropDown:[], //法人名称
                testSpareData:[{
                    name:"111"
                }],//待检验备件明细
                //查询禁用
                selectDisabled:false,

                loading:false,
            };
        },
        created:function(){
            this.languageType=="zh"?this.nowLangue=this.languageScoped.zh:this.nowLangue=this.languageScoped.en;
        },
        computed:{
            languageType(){
                return this.$store.state.languageType;
            }
        },
        watch:{
            languageType(){
                this.languageType=="zh"?this.nowLangue=this.languageScoped.zh:this.nowLangue=this.languageScoped.en;
            }
        },
        //进入页面立即运行此方法
        mounted: function () {
            var _this = this;
            _this.$store.commit('currentActive', 'TestRecord');
        },
        methods:{
            // 选择创建开始日期
            selectedCreateTimeBegin(val){

            },
            // 选择创建结束日期
            selectedCreateTimeEnd(val){

            },
            //查询列表
            queryClick(){
                /*var _this=this;
                 _this.loading=true;
                 var urlAddress="";
                 if(this.isClickBySelect){
                     urlAddress="projectSubstitute/queryMaterialByPage";
                 }else{
                     urlAddress="projectSubstitute/queryIncreasementMaterialByPage";
                 }
                 var tmp={
                     productLineId:_this.formInline.productLineId,
                     legalPersonCode:_this.formInline.legalPersonCode,
                     startCreateTime:_this.formInline.startCreateTime,
                     endCreateTime:_this.formInline.endCreateTime,
                     materialCode:_this.formInline.materialCode,
                     materialName:_this.formInline.materialName,
                     status:_this.formInline.status,
                     pageIndex:_this.pageIndex,
                     pageSize:_this.pageSize
                 };
                 $.ajax({
                     type: 'POST',
                     url: _this.metadata_service+urlAddress,
                     cache: false,
                     data:JSON.stringify(tmp),
                     dataType:'JSON',
                     contentType: "application/json;charset=utf-8",
                     success: function (data) {
                         if (data.success) {
                             _this.loading=false;
                             _this.isPaging=true;
                             _this.totalPage=data.data.totalPage;
                             _this.totalNumber=data.data.totalNumber;
                             _this.productData=data.data.dataList;
                         }else{
                             _this.loading=false;
                            _this.common.errorTip(data.errorMessage)
                         }
                     }
                 });*/
            },
            add(){
                this.$router.push({ path: 'CreateTestRecord', query: { }});
            },
            update(){
                this.$router.push({ path: 'UpdateTestRecord', query: { }});
            },
            check(){
                this.$router.push({ path: 'CreateTestRecord', query: { }});
            },
            judge(){
                this.$router.push({ path: 'JudgeTestRecord', query: { }});
            }
        }
    }
</script>



